/*
 * @Author: lijunqing
 * @Date: 2024-04-22 14:47:08
 * @LastEditors: lijunqing
 * @LastEditTime: 2024-04-22 15:27:55
 * @Description:
 */
const experss = require("express");

const app = experss();

// app.use((req, res, next) => {
//   if (req.headers["content-type"] === "application/json") {
//     req.on("data", (data) => {
//       const jsonInfo = JSON.parse(data.toString());
//       req.body = jsonInfo;
//     });

//     req.on("end", () => {
//       next();
//     });
//   } else {
//     next();
//   }
// });


app.use(experss.json())
app.post("/login", (req, res) => {
  console.log(req.body);
});
// 案例二: 注册用户的请求处理 /register post => username/password

app.listen(3000, () => {
  console.log("启动服务");
});
